﻿using KS3.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KS3 {
    public class ImageServer {
        private static KS3Client ks3Client;
        public static String EndPoint = "ks3-cn-beijing.ksyun.com";//此处以北京region为例
        public static void InitK3Client() {
            ClientConfiguration config = new ClientConfiguration();
            config.setTimeout(5 * 1000);
            config.setReadWriteTimeout(5 * 1000);
            config.setMaxConnections(20);

            String accessKey = "AKLTKvhOZtyyRvSrrejK3b_jiw";
            String secretKey = "OJYinyUShwIP3WMNYjlrAKS/dst/ilzlWBFys2KTlFHSYXwkKpSxPFSwrRphsz0QPg==";

            ks3Client = new KS3Client(accessKey, secretKey);
            ks3Client.setEndpoint(EndPoint);
        }

        public static PutObjectResult Upload(PutObjectRequest obj) {
            return ks3Client.putObject(obj);
        }
    }
}
